import { translateByCode } from '@/lib/getTransData.js';
import validator from '../index.js';
import { VerifyCodeVO } from '@/lib/form/verifyCode.js';
// 验证码验证
export class VerifyCodeVO_Rules extends VerifyCodeVO {
  constructor() {
    super();
    this.verifyCode = [
      {
        required: true,
        message: translateByCode('rules.verifyCode'),
        trigger: 'blur'
      },
      {
        min: 4,
        max: 4,
        message: translateByCode('rules.validVerifyCode'),
        trigger: 'blur'
      },
      {
        validator(rule, value, callback) {
          callback(validator.checkVerifyCode(value, translateByCode('rules.validAPIVerifyCode')));
        },
        trigger: 'blur'
      }
    ];
  }
}
